home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / SETXTSTY.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  1.2 KB  |  40 lines

  1.  
  2. /* setxtsty.c      Turbo C Bible, page 858 */
  3. #include <graphics.h>
  4. main()
  5. {
  6.     int graphdriver = DETECT, graphmode, xmax, ymax, xsize, ysize, x, y, c;
  7.     void *i_buf;
  8.                 /* Detect and initialize graphics system */
  9.     initgraph(&graphdriver, &graphmode, "c:\\turboc");
  10.                 /* Define a viewport */
  11.     xmax = getmaxx();
  12.     ymax = getmaxy();
  13.     xsize = xmax - 100;
  14.     ysize = ymax - 60;
  15.     setviewport(50, 30, xsize+50, ysize+30, 1);
  16.     setfillstyle(SOLID_FILL, RED);
  17.     bar3d( 0, 0, xsize, ysize, 0, 1);
  18.         /* Mark the center of the viewport and show how vertical
  19.          * and horizontal text looks */
  20.     x = xsize/2;
  21.     y = ysize/2;
  22.     setlinestyle(DASHED_LINE, 0,NORM_WIDTH);
  23.     moveto(0,y);
  24.     lineto(xsize,y);
  25.     moveto(x,0);
  26.     lineto(x,ysize);
  27.     setcolor(YELLOW);
  28.                 /* Use (left, bottom) justification */
  29.     settextjustify(LEFT_TEXT, BOTTOM_TEXT);
  30.     settextstyle(SANS_SERIF_FONT, HORIZ_DIR, 1);
  31.     outtextxy(x,y,"H o r i z o n t a l");
  32.     settextstyle(SANS_SERIF_FONT, VERT_DIR, 1);
  33.     outtextxy(x,y,"V e r t i c a l");
  34.                 /* Print a message in default font */
  35.     settextstyle(DEFAULT_FONT, HORIZ_DIR, 1);
  36.     outtextsty(10,ysize-10,"Press any key to exit");
  37.     getch();
  38.                 /* Close graphics system when done */
  39.     closegraph();
  40. }